package com.sevenstudio.adu.gasing.state;

import com.sevenstudio.adu.gasing.define.iGameDefines;
import com.sevenstudio.adu.gasing.element.ABackground;
import com.sevenstudio.adu.gasing.element.AScene;
import com.sevenstudio.adu.gasing.element.ASprite;
import com.sevenstudio.adu.gasing.engine.GameEngine;
import com.sevenstudio.adu.gasing.engine.Utils;

public class State_Logo {

	GameEngine engine;
	AScene scene, scene2;
	ASprite logo;
	ABackground logo2;
	public static int _logo;
	
	public State_Logo(GameEngine engine)
	{
		_logo = 0;
		
		this.engine = engine;
//		scene = new AScene(1);
//		logo = new ASprite(engine, iGameDefines.SPRITE_LOADING, iGameDefines.SPRITE_LOGO_AMIKOM);
		logo2 = new ABackground(engine, iGameDefines.SPRITE_LOADING, iGameDefines.SPRITE_LOGO_SEVEN);

		logo = new ASprite(engine, iGameDefines.SPRITE_LOADING, iGameDefines.SPRITE_LOGO_GITS);
		scene = new AScene(0);
		engine.SetGameScene(scene);
		engine.SceneAttach(scene, logo);
	}
	
	public void Init() 
	{
		Utils.TRACE("Logo init "+_logo);
		switch (_logo) {
		case 0:
			
//			engine.WaitTimeCapture();
			engine.SetNextMessageState(engine.NextMessageState());
			break;

		case 1:
			Utils.TRACE("Logo 2");
			engine.SceneAttach(scene, logo2);
			engine.SetNextMessageState(engine.NextMessageState());
			break;
		}
		
	}

	public void Update() 
	{
		
		switch (_logo) {
		case 0:
			if(engine.IsTimePassed(iGameDefines.WAIT_TIME_MEDIUM))
			{
				engine.SetNextMessageState(engine.NextMessageState());
			}
			break;

		case 1:
			if(engine.IsTimePassed(iGameDefines.WAIT_TIME_SHORT))
			{
				engine.SetNextMessageState(engine.NextMessageState());
			}
			break;
		}
		
		
	}

	public void Exit() 
	{
		switch (_logo) {
		case 0:
//			logo.DetachSelf();
			
			engine.SetNextMessageState(engine.NextMessageState());
//			engine.SetNextGameState(engine.NextGameState());
			Utils.TRACE("exit");
			Utils.TRACE("Logo "+_logo);
			_logo = 1;
			
			break;

		case 1:
			engine.SetNextMessageState(engine.NextMessageState());
			engine.SetNextGameState(engine.NextGameState());
			break;
		}
		
		
	}

}
